import { Component, ElementRef, EventEmitter, Input, OnInit, Output, Renderer2 } from '@angular/core';

@Component({
  selector: 'da-side-menu',
  templateUrl: './side-draw.component.html',
  styleUrls: ['./side-draw.component.scss']
})
export class SideMenuComponent implements OnInit {

  @Input() data: any;
  @Output() itemHovered = new EventEmitter<string>();
  @Output() mouseLeave = new EventEmitter<boolean>();

  constructor(private el: ElementRef, private renderer: Renderer2) {}
 activeItem: string;

  ngOnInit(): void {
  }
  private timeoutId: any;
  setActive(item: any) {
    this.timeoutId=setTimeout(() => {
      this.activeItem = item.title;
      this.itemHovered.emit(item);
    }, 200);
  }
  onMouseLeave() {
    clearTimeout(this.timeoutId);
  }
  onMouseLeaveDiv(){
    this.mouseLeave.emit(false);
  }

}
